//
//  ProfileHomeView.swift
//  App_Profile
//
//  Created by 蒋晨成 on 2022/1/14.
//

import Adaptor
import RxCocoa
import RxSwift
import UICore
import UIKit

class ProfileHomeContentView: UIScrollView {
    private lazy var contentView: UIView = .init()
        .x
        .backgroundColor(.clear)
        .instance

    lazy var infoView: ProfilePersonalInfoView = {
        let view = ProfilePersonalInfoView()
        view.backgroundColor = .clear
        return view
    }()

    override init(frame: CGRect) {
        super.init(frame: frame)
        contentInsetAdjustmentBehavior = .never
        alwaysBounceVertical = true
        setupUI()
    }

    @available(*, unavailable)
    required init?(coder _: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

extension ProfileHomeContentView {
    func setupUI() {
        contentView.x.add(to: self)

        infoView.x.add(to: contentView).snp.makeConstraints {
            $0.top.leading.trailing.equalToSuperview()
        }

        contentView.snp.makeConstraints {
            $0.edges.equalToSuperview()
            $0.width.equalToSuperview()
            $0.bottom.equalTo(infoView)
        }
    }
}
